
import sys
sys.path.append('/Users/paolopuggioni/DTC/PhDcoding/input_inference/myfunctions')
import par_est_class as pec

import numpy
from scipy import *
import time

# ------------------- DICTIONARIES

Syn_exc_par={}
Syn_inh_par={}
Pas_par={}
Fr_par={}
Init_par={}
Sim_par={}

# ------------------- SYNAPTIC PARAMETERS


# --------- Excitatory
Syn_exc_par['tau1']=0.0003; # seconds
Syn_exc_par['tau2']=0.002; # seconds
Syn_exc_par['Bee']=0.008*exp(1); #units of Gl
Syn_exc_par['Beestd']=Syn_exc_par['Bee']*0.8; 
Syn_exc_par['WeightDist']='Normal'; #Normal/LogNormal


# --------- Inhibitory
Syn_inh_par['tau1']=0.0003; # seconds
Syn_inh_par['tau2']=0.002; # seconds
Syn_inh_par['Bei']=0.075*exp(1); # units of Gl
Syn_inh_par['Beistd']=Syn_inh_par['Bei']*0.8; 
Syn_inh_par['WeightDist']='Normal'; #Normal/LogNormal


# ---------------------------- PASSIVE PARAMETERS
Pas_par['C']=100. *10**(-12);
Pas_par['gl']=5.55 *10**(-9);

Pas_par['Ee']=0.;
Pas_par['Ei']=-70.;
Pas_par['El']=-62.;

Pas_par['thr']=-48.;
Pas_par['thr_res']=-52.;
Pas_par['tau_ref']=5.;

# ---------------------------- FREQUENCY PAR

Fr_par['e']=5.;
Fr_par['i']=0.;


# ---------------------------- INITIALIZATION PAR
Init_par['I']=(-50.0 * 10**(-9)) # 

# ---------------------------- SIMULATION PAR

Sim_par['duration']=1.

Sim_par['Monitors_exc_size']=1000
Sim_par['Monitors_inh_size']=1000



# ---------------------------- STARTING

nm1=nc.IFnetwork(Net_par,Syn_exc_par,Syn_inh_par,Syn_x_par,Pas_par,Fr_par,Init_par,Sim_par)


nm1.buildPopulation()

nm1.buildConnection()

nm1.buildMonitors(Sim_par['Monitors_exc_size'],Sim_par['Monitors_inh_size'])

nm1.initialParam()

nm1.runSim(Sim_par['duration'])

nm1.grabResults()

nm1.loop1D(1,0,10,11)

nm1.save_loop('fr_loop','../datasave/') # ('filename','folder/')






